//
//  LSZPersonalInformationManager.m
//  JKFuYinProject
//
//  Created by 九酷 on 2017/9/30.
//  Copyright © 2017年 LC. All rights reserved.
//

#import "LSZPersonalInformationManager.h"

@implementation LSZPersonalInformationManager
-(id)initWithPersonalInformationManager:(NSDictionary *)dic
{
    self = [super init];
    if (self) {
        self.mutDataArray = [NSMutableArray array];
        if ([[dic valueForKey:@"data"] isKindOfClass:[NSString class]]) {
            return self;
        }
        if ([[dic valueForKey:@"data"] isKindOfClass:[NSNumber class]]) {
            return self;
        }
        if (![dic valueForKey:@"data"]) {
            return self;
        }
        NSDictionary * dicData = dic[@"data"];
        //存储用户的uid
        NSUserDefaults * userDefaults = [NSUserDefaults standardUserDefaults];
        NSString * uid = [NSString stringWithFormat:@"%@",dic[@"data"][@"uid"]];
        //用户名
        [userDefaults setObject:[NSString stringWithFormat:@"%@",dicData[@"username"]] forKey:@"username"];
        [userDefaults setObject:uid forKey:@"uid"];
     
        
        
        LSZPersonalInformationMg * informationMg = [[LSZPersonalInformationMg alloc]init];
          informationMg.uid = [NSString stringWithFormat:@"%@",dicData[@"uid"]];
        informationMg.username = [NSString stringWithFormat:@"%@",dicData[@"username"]];
        informationMg.avatar = [NSString stringWithFormat:@"%@",dicData[@"avatar"]];
        informationMg.gid = [NSString stringWithFormat:@"%@",dicData[@"gid"]];
        informationMg.incode = [NSString stringWithFormat:@"%@",dicData[@"incode"]];
        informationMg.score = [NSString stringWithFormat:@"%@",dicData[@"score"]];
        informationMg.credit = [NSString stringWithFormat:@"%@",dicData[@"credit"]];
        informationMg.cash = [NSString stringWithFormat:@"%@",dicData[@"cash"]];
        informationMg.hid     = NullStringjudgment(NSStr(dicData[@"hid"]));
        NSString * genderStr = [NSString stringWithFormat:@"%@",dicData[@"gender"]];
        if ([genderStr isEqualToString:@"1"]) {
             informationMg.gender = @"男";//性别
        }else if ([genderStr isEqualToString:@"2"])
        {
            informationMg.gender = @"女";
        }else{
            informationMg.gender = @"";
        }
        informationMg.location  = [NSString stringWithFormat:@"%@",dicData[@"location"]];//地区

        NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
        [defaults setObject:dicData[@"city"] forKey:@"location"];
        [defaults synchronize];

        informationMg.dob  = [NSString stringWithFormat:@"%@",dicData[@"dob"]];
        informationMg.education  = [NSString stringWithFormat:@"%@",dicData[@"education"]];
        informationMg.occupation  = [NSString stringWithFormat:@"%@",dicData[@"occupation"]];
        informationMg.interests  = [NSString stringWithFormat:@"%@",dicData[@"interests"]];
        informationMg.passport     = NullStringjudgment(NSStr(dicData[@"passport"]));
        //此处就一个数组
        [self.mutDataArray addObject:informationMg];
    }
    return self;
}
@end

@implementation LSZPersonalInformationMg

@end
